package com.example.focusimageview;

import android.app.Dialog;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.focusimageview.util.AESUtils;

import java.util.List;

import fule.com.mydatapicker.DatePickerDialog;
import fule.com.mydatapicker.DateUtil;

public class MainActivity extends AppCompatActivity {
    private Button button;
    private TextView textView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        String content = "hahahdfshhfshdfh的哈啥付话费回单付" + System.currentTimeMillis();
        System.out.println("加密前:" + content);
        String entry = AESUtils.Encrypt(content, "ijkplayerandroid");
        System.out.println("加密后:" + entry);
        String detry = AESUtils.Decrypt(entry, "ijkplayerandroid");
        System.out.println("解密后:" + detry);
    }

    private void showDateDialog(List<Integer> date) {
        DatePickerDialog.Builder builder = new DatePickerDialog.Builder(this);
        builder.setOnDateSelectedListener(new DatePickerDialog.OnDateSelectedListener() {
            @Override
            public void onDateSelected(int[] dates) {
                textView.setText(String.format("%d-%s-%s", dates[0], dates[1] > 9 ? dates[1] : ("0" + dates[1]), dates[2] > 9 ? dates[2] : ("0" + dates[2])));
            }

            @Override
            public void onCancel() {

            }
        })
                .setSelectYear(date.get(0) - 1)
                .setSelectMonth(date.get(1) - 1)
                .setSelectDay(date.get(2) - 1);
        builder.setMaxYear(DateUtil.getYear());
        builder.setMaxMonth(DateUtil.getDateForString(DateUtil.getToday()).get(1));
        builder.setMaxDay(DateUtil.getDateForString(DateUtil.getToday()).get(2));
        Dialog dateDialog = builder.create();
        dateDialog.show();


    }
}